
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BusinessObject;
using DataAccessLayer;

namespace BusinessLogic
{
    /// <summary>
    /// Define MatHangTonKhoUtil class. This class user for BussinessLayer.

    /// </summary>
    public class MatHangTonKhoUtil
    {
        /// <summary>
        /// Define function Insert for MatHangTonKho Object.
        /// </summary>
        /// <param name="t">object data need Insert.</param>
        /// <returns>
        ///    True: if insert successfull.
        ///    False: if insert error.
        ///</returns>
        public static bool Insert(MatHangTonKho t)
        {

            return MatHangTonKhoDao.Insert(t);
        }
        /// <summary>
        /// Define function Update for MatHangTonKho Object.
        /// </summary>
        /// <param name="t">project data need updated.</param>
        /// <returns>
        ///    True: if update successful.
        ///    False: if update Error.
        ///</returns>
        public static bool Update(MatHangTonKho t)
        {

            return MatHangTonKhoDao.Update(t);
        }
        /// <summary>
        /// Get All MatHangTonKho object from table MatHangTonKho.
        /// </summary>
        /// <returns>List MatHangTonKho object.</returns>
        public static List<MatHangTonKhoResult> GetAll()
        {
            return MatHangTonKhoDao.GetAll();
        }
        /// <summary>
        /// Search MatHangTonKho object in table MatHangTonKho.
        /// </summary>
        /// <param name="t">Condition for Search.</param>

        /// <returns>List MatHangTonKhoResult objects.</returns>

        public static List<MatHangTonKhoResult> SearchMatHangTonKhoSomeCondition(MatHangTonKho t)
        {
            return MatHangTonKhoDao.SearchMatHangTonKhoSomeCondition(t);
        }
        /// <summary>
        /// Get a MatHangTonKho data object by primary key. 
        /// </summary>
        /// <param name="maKho" >This is primary key.</param>
        /// <param name="maMatHang" >This is primary key.</param>
        /// <param name="maDonViTinh" >This is primary key.</param>
        /// <returns>A MatHangTonKho object.</returns>

        public static MatHangTonKho Get(int maKho, string maMatHang, int maDonViTinh)
        {
            return MatHangTonKhoDao.Get(maKho, maMatHang, maDonViTinh);
        }
        /// <summary>
        /// This function to Delete MatHangTonKho object by primary key.
        /// </summary>
        /// <param name="maKho" >This is primary key.</param>
        /// <param name="maMatHang" >This is primary key.</param>
        /// <param name="maDonViTinh" >This is primary key.</param>
        /// <returns>If succesful return True else  return False.</returns>

        public static bool Delete(int maKho, string maMatHang, int maDonViTinh)
        {

            return MatHangTonKhoDao.Delete(maKho, maMatHang, maDonViTinh);
        }
        public static List<ChiTietTonKho> GetThongKeTonKho(int maKho, int chungXe, int maXe, string maMH, string maPT, string orderBy, string orderDirection,int pIndex,int pSize, ref int total)
        {
            
            return MatHangTonKhoDao.GetThongKeTonKho(maKho, chungXe, maXe, maMH, maPT,orderBy,orderDirection,pIndex,pSize,ref total);
        }
        public static List<ChiTietTonKho> GetThongKeTonKho(int maKho, int maloaiHH, int chungXe, int maXe, string maMH)
        {
            if (maKho <= 0)
                return null;
            return MatHangTonKhoDao.GetThongKeTonKho(maKho,maloaiHH,chungXe,maXe,maMH);
        }
       
        public static void ThongKeDoanhThuBanHang(string condition, ref int soPhieu, ref double TongTien)
        {
            MatHangTonKhoDao.ThongKeDoanhThuBanHang(condition, ref soPhieu, ref TongTien);
        }
        public static void ThongKeDoanhThuNhapHang(string condition, ref int soPhieu, ref double TongTien)
        {
            MatHangTonKhoDao.ThongKeDoanhThuNhapHang(condition, ref soPhieu, ref TongTien);
        }
        public static bool CapNhatMatHangTonKho(List<MatHangTonKho> obj, PhieuCapNhatTonKho objPhieuCapNhatTonKho)
        {
            return MatHangTonKhoDao.CapNhatMatHangTonKho(obj, objPhieuCapNhatTonKho);
        }
    }
}